package x.trident.core.pojo.response;

/**
 * @ClassName: CodeMsg
 * @Description: 类描述
 * @Author: zza
 * @CreateDate: 2023/5/23 11:49
 * @UpdateUser: zza
 * @UpdateDate: 2023/5/23 11:49
 */
public class CodeMsg {
    public static CodeMsg OK = new CodeMsg("200", "code.msg.ok", "请求成功。");
    public static CodeMsg Created = new CodeMsg("201", "code.msg.created", "请求成功，新的资源已创建。");
    public static CodeMsg Accepted = new CodeMsg("202", "code.msg.accepted", "请求成功，后续进行异步处理。");
    public static CodeMsg No_Content = new CodeMsg("204", "code.msg.no.content", "内容不存在。");
    public static CodeMsg Multiple_Choices = new CodeMsg("300", "code.msg.multiple.choices", "存在多个资源。");
    public static CodeMsg Moved_Permanently = new CodeMsg("301", "code.msg.moved.permanently", "资源被永久转移。");
    public static CodeMsg Not_Modified = new CodeMsg("304", "code.msg.not.modified", "自上一次访问后没有发生更新。");
    public static CodeMsg Temporary_Redirect = new CodeMsg("307", "code.msg.temporary.redirect", "请求的资源被暂时转移。");
    public static CodeMsg Bad_Request = new CodeMsg("400", "code.msg.bad.request", "请求不正确。");
    public static CodeMsg Unauthorized = new CodeMsg("401", "code.msg.unauthorized", "认证失效。");
    public static CodeMsg Forbidden = new CodeMsg("403", "code.msg.forbidden", "禁止访问。");
    public static CodeMsg Not_Found = new CodeMsg("404", "code.msg.not.found", "没有找到指定资源。");
    public static CodeMsg Method_Not_Allowed = new CodeMsg("405", "code.msg.method.not.allowed", "无法使用指定的方法。");
    public static CodeMsg Not_Acceptable = new CodeMsg("406", "code.msg.not.acceptable", "同Accept相关联的首部里含有无法处理的内容。");
    public static CodeMsg Request_Timeout = new CodeMsg("408", "code.msg.request.timeout", "请求在规定时间内没有处理结束。");
    public static CodeMsg Conflict = new CodeMsg("409", "code.msg.conflict", "资源存在冲突。");
    public static CodeMsg Gone = new CodeMsg("410", "code.msg.gone", "指定的资源已不存在。");
    public static CodeMsg Request_Entity_Too_Large = new CodeMsg("413", "code.msg.request.entity.too.large", "请求消息体太大。");
    public static CodeMsg Request_Uri_Too_Long = new CodeMsg("414", "code.msg.request.uri.too.long", "请求的URI太长。");
    public static CodeMsg Unsupported_Media_Type = new CodeMsg("415", "code.msg.unsupported.media.type", "不支持所指定的媒体类型。");
    public static CodeMsg Too_Many_Request = new CodeMsg("429", "code.msg.too.many.request", "请求次数过多。");
    public static CodeMsg Internal_Server_Error = new CodeMsg("500", "code.msg.internal.server.error", "服务端发生错误。");
    public static CodeMsg Service_Unavailable = new CodeMsg("503", "code.msg.service.unavailable", "服务器暂时停止运行。");
    public static CodeMsg Search_Fail = new CodeMsg("10000", "code.msg.search.fail", "数据查询失败。");
    public static CodeMsg Add_Fail = new CodeMsg("20000", "code.msg.add.fail", "数据添加失败。");
    public static CodeMsg Save_Fail = new CodeMsg("30000", "code.msg.save.fail", "数据保存失败。");
    public static CodeMsg Update_Fail = new CodeMsg("40000", "code.msg.update.fail", "数据更新失败。");
    public static CodeMsg Delete_Fail = new CodeMsg("50000", "code.msg.delete.fail", "数据删除失败。");
    private String code;
    private String msg;
    private String defaultMsg;

    public CodeMsg() {
    }

    public CodeMsg(String code, String defaultMsg) {
        this.code = code;
        this.defaultMsg = defaultMsg;
    }

    public CodeMsg(String code, String msg, String defaultMsg) {
        this.code = code;
        this.msg = msg;
        this.defaultMsg = defaultMsg;
    }

    public String getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
        //return MessageUtils.getMessageDefault(this.msg, this.defaultMsg, new Object[0]);
    }

    public String getDefaultMsg() {
        return this.defaultMsg;
        //return MessageUtils.getMessageDefault(this.msg, this.defaultMsg, new Object[0]);
    }

    public String toString() {
        return "CodeMsg{code=" + this.code + ", msg='" + this.msg + '\'' + ", defaultMsg='" + this.defaultMsg + '\'' + '}';
    }
}
